<?php
/**
 * The Template for displaying product archives, including the main shop page which is a post type archive.
 *
 * Override this template by copying it to yourtheme/woocommerce/archive-product.php
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.0
 */
if (!defined('ABSPATH'))
    exit; // Exit if accessed directly
$option = get_option('kkfashion_1_settings');
get_header('shop');
?>
<script type="text/javascript">
    $('.header').addClass('product shop-online');
</script>
<div class="row">
    <div class="col-lg-4 col-sm-4 col-12 header-description align-right">
        <div class="title step">
            <h2 class="line_1"><?php 
            $has_tag = false;
            $tags = array_merge(explode(",",$option['footer_tags']),explode(",",$option['news_tags']),explode(",",$option['dcs_tags']),explode(",",$option['pk_tags']),explode(",",$option['vcn_tags']),explode(",",$option['ddh_tags']));
            foreach($tags as $tag){
                if(trim(vn_str_filter($tag))==single_term_title( "", false )) {
                    echo $tag;
                    $has_tag = true;
                    break;
                }
            }
            if($has_tag==false) echo single_term_title( "", false );// woocommerce_page_title(); 
            ?></h2>

        </div>
    </div>
</div>
</div>
</div>
<div class="main-content container">
    <div class="row">
        <?php
        wp_reset_query();
        global $wp_query, $product;

        $args = array_merge($wp_query->query_vars, array('posts_per_page' => '24', 'orderby' => 'post_title', 'order' => 'DESC'));
        query_posts($args);

        if (have_posts()) :
            $i = 0;
            while (have_posts()) : the_post();

               
                    echo!$i || !($i % 6) ? '<div class="row">' : '';
                    woocommerce_get_template_part('content', 'product_tag');
                    echo!(($i + 1) % 6) ? '</div>' : '';
                    $i++;
                endwhile; // end of the loop.  
                 echo (($i) % 6) ? '</div>' : '';
                ?>
                <!-- pagination --> 
                <div class="paginations">
                    <?php do_action('woocommerce_pagination') //echo woo_pagination($args);   ?>
                </div>
            </div>
        <?php elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) : ?>

            <?php woocommerce_get_template('loop/no-products-found.php'); ?>

        <?php endif; ?>



    </div>
</div>

<?php get_footer('shop'); ?>